
function trainNotes_index() {
    var _this = this;
    _this.page;
    _this.page_size = 10;

    _this.registerParams;

    _this.initTable = function(page){
        _this.page = page;
        var list_url = appPath + "/admin/trainNotes/selectTrainWarnList";
        _this.page.init("trainNotes_form", list_url, "trainNotes_table", "trainNotes_page", 1, _this.page_size);
        _this.page.goPage(1);
        _this.page.list = function(dataList){
            var len = dataList.length;
            var inner = "", item;
            var messageContent = '';
            // 组装数据
            for(var i=0; i< len; i++) {
                item = dataList[i];
                inner += '<tr>';
                inner += '<td>'+ item['messageTitle'] + '</td>';
                messageContent = item['messageContent'];
                inner += '<td>'+ messageContent.split('<div>')[0] + '</td>';
                inner += '<td>'+ TimeUtil.longMsTimeConvertToDateTime(item['createTime']) + '</td>';
                var messageStatus = item['messageStatus'] == "1" ? "未读" : "已读";
                inner += '<td>'+ messageStatus + '</td>';

                inner += "<td><a href=javascript:warnInfo('"+item.companyId + "','" + item.messageTitle +"') target=\"_blank\" class='a a-info'>查看详情</a>";

                inner += '</td></tr>';
            }
            return inner;
        }
    };
    _this.ajax = function(url, param, type) {
        var result;
        $.ajax({
            url : url,
            async : false,
            type : 'post',
            data : param,
            success : function(data) {
                result = data;
            }
        });
        return result;
    };


}


var trainNotes_index = new trainNotes_index();


//培训预警
warnInfo = function (cid, title) {
    var month = title.replace("年", "").replace("月培训预警", "");
    layer.open({
        type: 2,
        title: '',
        area: ['1000px', '700px'],		//弹出层大小
        scrollbar: false,				//false隐藏滑动块
        content: [appPath + '/admin/trainNotes/toWarnInfo?title=' + title + '&companyId=' + cid + '&month=' + month, 'yes']
    });
};
// 培训政策须知
trainPolicyNotes = function () {
    $.ajax({
        url: appPath + "/admin/selectTrainPolicyList",
        type: "POST",
        cache: false,
        async: false,
        dataType: "json",
        success: function (data) {
            var code = data.code;
            var result = data.result;
            if ( code == '10000') {
                setCookie("trainPolicyNotes", "1");
                if(result.length == 0){
                    return;
                }
                var html = '<div>';
                for(var i = 0; i < result.length;i++){
                    html += '<div style="margin-top: 15px;margin-right: 30px;">';
                    html += '<h2 style="margin-left: 35px;">'+ result[i].businessName +'</h2>';
                    html += '<div style="margin-top: 15px;margin-bottom: 15px; margin-left: 70px;line-height: 25px;font-size: 16px;font-family: 微软雅黑;"><span style="display:block;text-indent: 2em;">'+ result[i].content +'</span></div>';
                    html += '</div>';
                }
                html += '</div>';

                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim',
                    title: '培训政策须知',
                    shadeClose: true,
                    shade: 0.1,
                    area: ['940px', '600px'],
                    content: html //iframe的url
                });



            }
        }
    });}
